<?php

include 'config.inc.php';
include _ITSTOCK_LIB_DIR_.'common.inc.php';

itstock_session_start();

if (isset($_POST["user"]) && isset($_POST["pass"])) {
  if (itstock_login($_SESSION['user'], $_POST["user"], $_POST["pass"])) {
    header(sprintf('Location: %s', ( isset($_SESSION['uri']) ? $_SESSION['uri'] : 'main.php')));
    exit();
  }
}
header("Location: index.php");
?>
